"""
-----------------------------
   File Name:token_util
   Author:cwei
   date: 2023/7/30-17:10
-----------------------------
"""
from api.kdtxapi import KDTXAPI


class GetTokenUtil:
    @classmethod
    def kdtx_get_token(cls):
        code_res = KDTXAPI.get_code_api()
        uuid = code_res.json().get('uuid')

        body = {
            "username": "admin",
            "password": "HM_2023_test",
            "code": "2",
            "uuid": uuid
        }
        res = KDTXAPI.login_api(body)
        token = res.json().get("token")

        return token

        pass


if __name__ == '__main__':
    print(GetTokenUtil.kdtx_get_token())